package com.daxin.controller;


import com.daxin.pojo.Group;
import com.daxin.service.GroupService;
import com.daxin.vo.GroupMemberVO;
import com.daxin.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/group")
public class GroupController {
    @Autowired
    private GroupService groupService;

    @PostMapping("/newGroup")
    public SysResult newGroup(@RequestBody GroupMemberVO groupMemberVO){
        groupService.newGroup(groupMemberVO.getDxidList());
        return SysResult.success("ok","群聊创建成功");
    }

    @GetMapping("/findGroup/{dxid}")
    private SysResult findGroup(@PathVariable String dxid){
        List<Group> list =  groupService.findGroup(dxid);
        return SysResult.success("ok",list);
    }
}
